[Ruby] Confirm existance of executable (script, bat, cmd, exe) via a ruby file.

Posted by srcspider on Stack Overflow See other posts from Stack Overflow or by srcspider
Published on 2010-06-03T21:38:52Z Indexed on 2010/06/03 22:04 UTC
Read the original article Hit count: 153

Filed under:
|
|

Using a ruby file (or any rake facility) I need to find out if the user who executes my script is able to execute certain shell commands. In particular g++ etc. Hopefully system independent so if there is some g++.bat, g++.exe or just g++ (etc) it should say yes nevertheless, as long as its on the path and executable on the users system.

Example: if the user has a no-extention executable version of the file and a .cmd version of the file it should say "yes" for the no extension version on a linux system and "yes" to the .cmd version on a windows system. Since the users shell can only execute that version of the file.

The purpose of this is to allow the script to be self-configuring (as much as possible).

Any suggestions on how I might go about doing this?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about rake